﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;
namespace mobliebo
{
    public class Admin
    {
        iDAC DAC = DACFactory.GetDAC();
        private string _id = "";
        private string _password = "";
        private bool _is_deleted = false;
        public string id
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }
        public string password
        {
            get
            {
                return _password;
            }
            set
            {
                _password = value;
            }
        }
        public bool is_deleted
        {
            get
            {
                return _is_deleted;
            }
            set
            {
                _is_deleted = value;
            }

        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@id", id, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2 };
                return DAC.Save("Admin_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(string id, string password, bool is_deleted, string andor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@id", id, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2 };
                // return DAC.Save("Admin_get",dbparamcall);
                DataTable dt1 = DAC.Select("Admin_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}

